﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ObTookit.HighLight
{
    public class HtmlHighLight :BaseHighLight
    {
        private void SetWords()
        {
            DefaultColor = Color.Black;
            Keywords = new string[] { "<!DOCTYPE>", "html>", "title>", "body>", "h1>", "h2>", "h3>", "h4>", "h5>", "h6>", "p>", "br>","hr>"
                , "form>", "input>", "textarea>", "button>", "select>","optgroup>", "option>", 
                "label>","fieldset>","legend>","datalist>","keygen>","output>"
                ,"frame>", "frameset>", "noframes>", "iframe>"
                ,"img>", "map>", "area>", "canvas>", "figcaption>", "figure>"
                ,"audio>", "source>", "track>", "video>"
                , "a>", "link>", "nav"
                , "ul>", "ol>", "li>", "dl>", "dt>","dd>","menu>","menuitem>","command>"
                , "table>", "caption>", "th>", "tr>", "td>", "thead>", "tbody>", "tfoot>", "col>", "colgroup>"
                , "style>" , "div>",  "span>", "header>", "footer>", "section>", "article>", "aside>", "details>","dialog>", "summary>"
                , "head>", "meta>" , "base>", "basefont>" 
                , "script>", "noscript>", "embed>", "object>", "param>" };
            KeywordColor = Color.Blue;

            Functions = new string[] { };
            FunctionColor = Color.Red;

            Strings = new string[] { };
            WhiteSpace = new string[] { };

            CommentTags = "!--";
            CommentColor = Color.Gray;

            SpecilChars = "";
        }
        public void SetWordsColor(System.Windows.Forms.RichTextBox rtb, string rtbText)
        {
            SetWords();
            rtb.SelectAll();
            rtb.SelectionColor = Color.Black;
            string text = rtb.Text;
            SetHighLight(rtb, text, Keywords, KeywordColor);
            SetHighLight(rtb, text, Functions, FunctionColor);
            SetHighLight(rtb, text, new string[] { CommentTags }, CommentColor, CodeType.COMMENT);
        }
    }
}
